<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>数据预处理 - 数据处理平台</title>
<script src="https://cdn.tailwindcss.com/3.4.16"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#3b82f6',
secondary: '#6366f1'
},
borderRadius: {
'none': '0px',
'sm': '4px',
DEFAULT: '8px',
'md': '12px',
'lg': '16px',
'xl': '20px',
'2xl': '24px',
'3xl': '32px',
'full': '9999px',
'button': '8px'
}
}
}
}
</script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/remixicon/4.6.0/remixicon.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js"></script>
<style>
:where([class^="ri-"])::before {
content: "\f3c2";
}
.custom-checkbox {
appearance: none;
width: 1rem;
height: 1rem;
border: 2px solid #d1d5db;
border-radius: 0.25rem;
background-color: white;
cursor: pointer;
position: relative;
}
.custom-checkbox:checked {
background-color: #3b82f6;
border-color: #3b82f6;
}
.custom-checkbox:checked::after {
content: '';
position: absolute;
left: 3px;
top: 1px;
width: 4px;
height: 8px;
border: solid white;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
.custom-switch {
width: 44px;
height: 24px;
background-color: #d1d5db;
border-radius: 12px;
position: relative;
cursor: pointer;
transition: background-color 0.3s;
}
.custom-switch.active {
background-color: #3b82f6;
}
.custom-switch::after {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: 20px;
height: 20px;
background-color: white;
border-radius: 50%;
transition: transform 0.3s;
}
.custom-switch.active::after {
transform: translateX(20px);
}
.custom-range {
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 6px;
border-radius: 3px;
background: #e5e7eb;
outline: none;
}
.custom-range::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #3b82f6;
cursor: pointer;
}
.custom-range::-moz-range-thumb {
width: 20px;
height: 20px;
border-radius: 50%;
background: #3b82f6;
cursor: pointer;
border: none;
}
.custom-radio {
appearance: none;
width: 1rem;
height: 1rem;
border: 2px solid #d1d5db;
border-radius: 50%;
background-color: white;
cursor: pointer;
position: relative;
}
.custom-radio:checked {
border-color: #3b82f6;
}
.custom-radio:checked::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 8px;
height: 8px;
border-radius: 50%;
background-color: #3b82f6;
}
.upload-area {
border: 2px dashed #d1d5db;
transition: all 0.3s ease;
}
.upload-area.dragover {
border-color: #3b82f6;
background-color: #eff6ff;
}
.step-item {
position: relative;
}
.step-item:not(:last-child)::after {
content: '';
position: absolute;
top: 50%;
right: -1rem;
width: 2rem;
height: 2px;
background-color: #e5e7eb;
transform: translateY(-50%);
}
.step-item.active::after {
background-color: #3b82f6;
}
.tool-button {
transition: all 0.2s ease;
}
.tool-button:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.tool-button.active {
border-color: #3b82f6;
background-color: #eff6ff;
}
</style>
</head>
<body class="bg-gray-50">
<div class="flex h-screen">
<aside class="w-64 bg-white shadow-sm border-r border-gray-200 flex flex-col">
<div class="p-4 border-b border-gray-200">
<div class="flex items-center">
<span class="text-xl font-bold text-gray-900 font-['Pacifico']">logo</span>
</div>
</div>
<nav class="flex-1 px-2 py-4">
<ul class="space-y-1">
<li>
<button class="flex items-center w-full px-3 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg">
<div class="w-5 h-5 flex items-center justify-center mr-2">
<i class="ri-dashboard-line"></i>
</div>
<span>模型管理</span>
<div class="w-5 h-5 flex items-center justify-center ml-auto">
<i class="ri-arrow-right-s-line"></i>
</div>
</button>
</li>
<li>
<button class="flex items-center w-full px-3 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg">
<div class="w-5 h-5 flex items-center justify-center mr-2">
</div>
<span>模型生命周期</span>
</button>
</li>
<li>
<button class="flex items-center w-full px-3 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg">
<div class="w-5 h-5 flex items-center justify-center mr-2">
</div>
<span>模型性能评估</span>
</button>
</li>
<li>
<button class="flex items-center w-full px-3 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg">
<div class="w-5 h-5 flex items-center justify-center mr-2">
</div>
<span>模型转换适配</span>
</button>
</li>
<li>
<button class="flex items-center w-full px-3 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg">
<div class="w-5 h-5 flex items-center justify-center mr-2">
<i class="ri-cpu-line"></i>
</div>
<span>推理服务</span>
</button>
</li>
<li>
<button class="flex items-center w-full px-3 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg">
<div class="w-5 h-5 flex items-center justify-center mr-2">
<i class="ri-api-line"></i>
</div>
<span>API 接口</span>
</button>
</li>
<li>
<button class="flex items-center w-full px-3 py-2 text-sm bg-primary text-white rounded-lg">
<div class="w-5 h-5 flex items-center justify-center mr-2">
<i class="ri-database-2-line"></i>
</div>
<span>数据处理</span>
<div class="w-5 h-5 flex items-center justify-center ml-auto">
<i class="ri-arrow-down-s-line"></i>
</div>
</button>
<ul class="ml-6 mt-2 space-y-1">
<li>
<button class="flex items-center w-full px-3 py-2 text-sm text-white bg-blue-600 rounded-lg">
<div class="w-4 h-4 flex items-center justify-center mr-2">
<i class="ri-filter-3-line"></i>
</div>
<span>数据预处理</span>
</button>
</li>
<li>
<button class="flex items-center w-full px-3 py-2 text-sm text-blue-200 hover:text-white hover:bg-blue-600 rounded-lg">
<div class="w-4 h-4 flex items-center justify-center mr-2">
<i class="ri-magic-line"></i>
</div>
<span>数据增强</span>
</button>
</li>
<li>
<button class="flex items-center w-full px-3 py-2 text-sm text-blue-200 hover:text-white hover:bg-blue-600 rounded-lg">
<div class="w-4 h-4 flex items-center justify-center mr-2">
<i class="ri-settings-3-line"></i>
</div>
<span>结果后处理</span>
</button>
</li>
</ul>
</li>
</ul>
</nav>
</aside>
<div class="flex-1 flex flex-col">
<header class="bg-white border-b border-gray-200 px-6 py-4">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-4">
<a href="https://readdy.ai/home/42b69b4b-e314-4f8d-9e2f-98a4952face1/89aef61f-e02e-4f74-9680-4a0d35936fdf" data-readdy="true" class="flex items-center text-gray-500 hover:text-gray-700">
<div class="w-5 h-5 flex items-center justify-center mr-2">
<i class="ri-arrow-left-line"></i>
</div>
<span class="text-sm">返回</span>
</a>
<nav class="text-sm text-gray-500">
<span>数据处理平台</span>
<span class="mx-2">/</span>
<span>数据处理</span>
<span class="mx-2">/</span>
<span class="text-gray-900">数据预处理</span>
</nav>
</div>
<div class="flex items-center space-x-4">
<div class="relative">
<select class="appearance-none bg-white border border-gray-300 rounded-lg px-4 py-2 pr-8 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
<option>生产环境</option>
<option>测试环境</option>
<option>开发环境</option>
</select>
<div class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
<i class="ri-arrow-down-s-line text-gray-400"></i>
</div>
</div>
<div class="relative">
<input type="text" placeholder="搜索任务..." class="bg-gray-50 border border-gray-300 rounded-lg pl-10 pr-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent w-64">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="ri-search-line text-gray-400"></i>
</div>
</div>
<button class="relative p-2 text-gray-400 hover:text-gray-600">
<div class="w-6 h-6 flex items-center justify-center">
<i class="ri-notification-3-line"></i>
</div>
<span class="absolute top-0 right-0 block h-2 w-2 rounded-full bg-red-500"></span>
</button>
<div class="flex items-center space-x-3">
<img src="https://readdy.ai/api/search-image?query=professional%20business%20portrait%20of%20a%20young%20asian%20software%20engineer%20in%20modern%20office%20setting%2C%20clean%20background%2C%20professional%20lighting%2C%20high%20quality%20headshot&width=40&height=40&seq=user_avatar&orientation=squarish" alt="用户头像" class="w-8 h-8 rounded-full object-cover">
<div class="text-sm">
<div class="text-gray-900 font-medium">张开发</div>
</div>
</div>
</div>
</div>
</header>
<main class="flex-1 overflow-auto">
<div class="p-6">
<div class="flex items-center justify-between mb-6">
<div>
<h1 class="text-2xl font-bold text-gray-900">数据预处理</h1>
<p class="text-gray-600 mt-1">提供全方位的数据清洗、格式转换和特征提取功能</p>
</div>
<div class="flex items-center space-x-3">
<button id="saveTemplateBtn" class="bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-button text-sm font-medium hover:bg-gray-50 whitespace-nowrap !rounded-button flex items-center">
<i class="ri-save-line mr-2"></i>
保存模板
</button>
<button id="loadTemplateBtn" class="bg-white border border-gray-300 text-gray-700 px-6 py-2 rounded-button text-sm font-medium hover:bg-gray-50 whitespace-nowrap !rounded-button flex items-center">
<i class="ri-folder-open-line mr-2"></i>
加载模板
</button>
<button id="startProcessBtn" class="bg-primary text-white px-6 py-2 rounded-button text-sm font-medium hover:bg-blue-600 whitespace-nowrap !rounded-button flex items-center">
<i class="ri-play-line mr-2"></i>
开始处理
</button>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6 mb-6">
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-200">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center bg-blue-100 rounded-lg">
<i class="ri-file-line text-blue-600 text-xl"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-600">待处理文件</p>
<p class="text-2xl font-bold text-gray-900">156</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-200">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center bg-green-100 rounded-lg">
<i class="ri-check-line text-green-600 text-xl"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-600">处理完成</p>
<p class="text-2xl font-bold text-gray-900">1,432</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-200">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center bg-yellow-100 rounded-lg">
<i class="ri-time-line text-yellow-600 text-xl"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-600">平均处理时间</p>
<p class="text-2xl font-bold text-gray-900">2.1秒</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg p-6 shadow-sm border border-gray-200">
<div class="flex items-center">
<div class="w-12 h-12 flex items-center justify-center bg-purple-100 rounded-lg">
<i class="ri-cpu-line text-purple-600 text-xl"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-600">CPU 使用率</p>
<p class="text-2xl font-bold text-gray-900">68.5%</p>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
<div class="lg:col-span-2 space-y-6">
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="p-6 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">文件上传区域</h2>
</div>
<div class="p-6">
<div id="uploadArea" class="upload-area rounded-lg p-8 text-center cursor-pointer">
<div class="w-16 h-16 flex items-center justify-center bg-gray-100 rounded-lg mx-auto mb-4">
<i class="ri-upload-cloud-2-line text-gray-400 text-2xl"></i>
</div>
<h3 class="text-lg font-medium text-gray-900 mb-2">拖拽文件到此处或点击上传</h3>
<p class="text-sm text-gray-500 mb-4">支持 CSV、JSON、XML、TXT、图像、音频等格式，单个文件最大 100MB</p>
<div class="flex items-center justify-center space-x-4">
<button id="selectFileBtn" class="bg-primary text-white px-4 py-2 rounded-button text-sm hover:bg-blue-600 !rounded-button">
选择文件
</button>
<button id="batchUploadBtn" class="bg-white border border-gray-300 text-gray-700 px-4 py-2 rounded-button text-sm hover:bg-gray-50 !rounded-button">
批量上传
</button>
</div>
<input type="file" id="fileInput" class="hidden" multiple accept=".csv,.json,.xml,.txt,.jpg,.jpeg,.png,.gif,.mp3,.wav,.mp4,.avi">
</div>
<div id="uploadedFiles" class="mt-4 space-y-2 hidden">
<h4 class="text-sm font-medium text-gray-700 mb-2">已上传文件</h4>
<div class="space-y-2" id="fileList"></div>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="p-6 border-b border-gray-200">
<div class="flex items-center justify-between">
<h2 class="text-lg font-semibold text-gray-900">预处理工具栏</h2>
<button id="resetToolsBtn" class="text-sm text-gray-500 hover:text-gray-700">
<i class="ri-refresh-line mr-1"></i>
重置
</button>
</div>
</div>
<div class="p-6">
<div class="grid grid-cols-2 gap-4">
<button class="tool-button flex flex-col items-center p-4 border-2 border-gray-200 rounded-lg hover:border-primary" data-tool="clean">
<div class="w-10 h-10 flex items-center justify-center bg-blue-100 rounded-lg mb-2">
<i class="ri-eraser-line text-blue-600"></i>
</div>
<span class="text-sm font-medium text-gray-900">数据清洗</span>
<span class="text-xs text-gray-500 mt-1">去除噪声和异常值</span>
</button>
<button class="tool-button flex flex-col items-center p-4 border-2 border-gray-200 rounded-lg hover:border-primary" data-tool="format">
<div class="w-10 h-10 flex items-center justify-center bg-green-100 rounded-lg mb-2">
<i class="ri-file-transfer-line text-green-600"></i>
</div>
<span class="text-sm font-medium text-gray-900">格式转换</span>
<span class="text-xs text-gray-500 mt-1">转换数据格式</span>
</button>
<button class="tool-button flex flex-col items-center p-4 border-2 border-gray-200 rounded-lg hover:border-primary" data-tool="feature">
<div class="w-10 h-10 flex items-center justify-center bg-purple-100 rounded-lg mb-2">
<i class="ri-function-line text-purple-600"></i>
</div>
<span class="text-sm font-medium text-gray-900">特征提取</span>
<span class="text-xs text-gray-500 mt-1">提取关键特征</span>
</button>
<button class="tool-button flex flex-col items-center p-4 border-2 border-gray-200 rounded-lg hover:border-primary" data-tool="normalize">
<div class="w-10 h-10 flex items-center justify-center bg-orange-100 rounded-lg mb-2">
<i class="ri-scales-3-line text-orange-600"></i>
</div>
<span class="text-sm font-medium text-gray-900">数据标准化</span>
<span class="text-xs text-gray-500 mt-1">归一化处理</span>
</button>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="p-6 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">预处理步骤配置</h2>
</div>
<div class="p-6">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-4">
<div class="step-item flex items-center space-x-2 active">
<div class="w-8 h-8 flex items-center justify-center bg-primary text-white rounded-full text-sm font-medium">1</div>
<span class="text-sm font-medium text-gray-900">数据输入</span>
</div>
<div class="step-item flex items-center space-x-2">
<div class="w-8 h-8 flex items-center justify-center bg-gray-200 text-gray-600 rounded-full text-sm font-medium">2</div>
<span class="text-sm font-medium text-gray-600">预处理</span>
</div>
<div class="step-item flex items-center space-x-2">
<div class="w-8 h-8 flex items-center justify-center bg-gray-200 text-gray-600 rounded-full text-sm font-medium">3</div>
<span class="text-sm font-medium text-gray-600">输出</span>
</div>
</div>
</div>
<div id="configPanel" class="space-y-4">
<div class="p-4 bg-gray-50 rounded-lg">
<p class="text-sm text-gray-600">请先上传文件并选择预处理工具来配置参数</p>
</div>
</div>
</div>
</div>
</div>
<div class="space-y-6">
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="p-6 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">实时预览</h2>
</div>
<div class="p-6">
<div id="previewArea" class="min-h-[300px] border-2 border-dashed border-gray-200 rounded-lg flex items-center justify-center">
<div class="text-center">
<div class="w-16 h-16 flex items-center justify-center bg-gray-100 rounded-lg mx-auto mb-4">
<i class="ri-eye-line text-gray-400 text-2xl"></i>
</div>
<h3 class="text-lg font-medium text-gray-900 mb-2">数据预览</h3>
<p class="text-sm text-gray-500">上传文件后将显示数据预览</p>
</div>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="p-6 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">处理进度监控</h2>
</div>
<div class="p-6">
<div class="space-y-4">
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">总体进度</span>
<span class="text-sm font-medium text-gray-900">0%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div id="overallProgress" class="bg-primary h-2 rounded-full transition-all duration-300" style="width: 0%"></div>
</div>
<div class="space-y-2">
<div class="flex items-center justify-between text-sm">
<span class="text-gray-600">数据清洗</span>
<span class="text-gray-500">待开始</span>
</div>
<div class="flex items-center justify-between text-sm">
<span class="text-gray-600">格式转换</span>
<span class="text-gray-500">待开始</span>
</div>
<div class="flex items-center justify-between text-sm">
<span class="text-gray-600">特征提取</span>
<span class="text-gray-500">待开始</span>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="p-6 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">模板管理</h2>
</div>
<div class="p-6">
<div class="space-y-3">
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center bg-blue-100 rounded-lg mr-3">
<i class="ri-file-text-line text-blue-600"></i>
</div>
<div>
<div class="text-sm font-medium text-gray-900">图像预处理模板</div>
<div class="text-xs text-gray-500">包含缩放、裁剪、归一化</div>
</div>
</div>
<button class="text-primary hover:text-blue-700 text-sm">应用</button>
</div>
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center bg-green-100 rounded-lg mr-3">
<i class="ri-file-text-line text-green-600"></i>
</div>
<div>
<div class="text-sm font-medium text-gray-900">文本清洗模板</div>
<div class="text-xs text-gray-500">去除特殊字符、分词处理</div>
</div>
</div>
<button class="text-primary hover:text-blue-700 text-sm">应用</button>
</div>
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center bg-purple-100 rounded-lg mr-3">
<i class="ri-file-text-line text-purple-600"></i>
</div>
<div>
<div class="text-sm font-medium text-gray-900">数据表预处理</div>
<div class="text-xs text-gray-500">缺失值填充、异常值检测</div>
</div>
</div>
<button class="text-primary hover:text-blue-700 text-sm">应用</button>
</div>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="p-6 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">批量处理设置</h2>
</div>
<div class="p-6">
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">批处理大小</label>
<input type="range" class="custom-range" min="1" max="1000" value="100" id="batchSizeSlider">
<div class="flex justify-between text-xs text-gray-500 mt-1">
<span>1</span>
<span id="batchSizeValue">100</span>
<span>1000</span>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">并发线程数</label>
<div class="relative">
<select class="appearance-none w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent pr-8">
<option>1</option>
<option>2</option>
<option selected>4</option>
<option>8</option>
<option>16</option>
</select>
<div class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
<i class="ri-arrow-down-s-line text-gray-400"></i>
</div>
</div>
</div>
<div>
<label class="flex items-center">
<input type="checkbox" class="custom-checkbox mr-2" checked>
<span class="text-sm text-gray-700">启用错误重试</span>
</label>
</div>
<div>
<label class="flex items-center">
<input type="checkbox" class="custom-checkbox mr-2">
<span class="text-sm text-gray-700">保存中间结果</span>
</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm border border-gray-200">
<div class="p-6 border-b border-gray-200">
<h2 class="text-lg font-semibold text-gray-900">处理日志</h2>
</div>
<div class="p-6">
<div id="logArea" class="bg-gray-900 text-green-400 p-4 rounded-lg font-mono text-sm h-48 overflow-y-auto">
<div class="text-gray-500">[系统] 数据预处理系统已就绪</div>
<div class="text-gray-500">[系统] 等待文件上传...</div>
</div>
</div>
</div>
</div>
</div>
<div class="fixed bottom-0 left-64 right-0 bg-white border-t border-gray-200 px-6 py-4">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-4">
<div class="text-sm text-gray-600">
已选择 <span id="selectedFileCount">0</span> 个文件
</div>
<div class="text-sm text-gray-600">
预计处理时间: <span id="estimatedTime">-</span>
</div>
</div>
<div class="flex items-center space-x-3">
<button id="clearAllBtn" class="bg-white border border-gray-300 text-gray-700 px-4 py-2 rounded-button text-sm hover:bg-gray-50 !rounded-button">
清空全部
</button>
<button id="exportResultBtn" class="bg-white border border-gray-300 text-gray-700 px-4 py-2 rounded-button text-sm hover:bg-gray-50 !rounded-button" disabled>
<i class="ri-download-line mr-2"></i>
导出结果
</button>
<button id="applyProcessBtn" class="bg-primary text-white px-6 py-2 rounded-button text-sm font-medium hover:bg-blue-600 !rounded-button" disabled>
<i class="ri-play-line mr-2"></i>
应用处理
</button>
</div>
</div>
</div>
<div id="templateModal" class="fixed inset-0 bg-black bg-opacity-50 hidden flex items-center justify-center z-50">
<div class="bg-white rounded-lg w-[600px] shadow-xl">
<div class="px-6 py-4 border-b border-gray-200 flex items-center justify-between">
<h3 class="text-lg font-semibold text-gray-900">保存预处理模板</h3>
<button id="closeTemplateModal" class="text-gray-400 hover:text-gray-600">
<div class="w-5 h-5 flex items-center justify-center">
<i class="ri-close-line"></i>
</div>
</button>
</div>
<div class="p-6">
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">模板名称</label>
<input type="text" id="templateName" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="请输入模板名称">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">模板描述</label>
<textarea id="templateDesc" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent" placeholder="请输入模板描述"></textarea>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">适用数据类型</label>
<div class="grid grid-cols-3 gap-2">
<label class="flex items-center">
<input type="checkbox" class="custom-checkbox mr-2">
<span class="text-sm text-gray-700">图像</span>
</label>
<label class="flex items-center">
<input type="checkbox" class="custom-checkbox mr-2">
<span class="text-sm text-gray-700">文本</span>
</label>
<label class="flex items-center">
<input type="checkbox" class="custom-checkbox mr-2">
<span class="text-sm text-gray-700">音频</span>
</label>
<label class="flex items-center">
<input type="checkbox" class="custom-checkbox mr-2">
<span class="text-sm text-gray-700">视频</span>
</label>
<label class="flex items-center">
<input type="checkbox" class="custom-checkbox mr-2">
<span class="text-sm text-gray-700">表格</span>
</label>
<label class="flex items-center">
<input type="checkbox" class="custom-checkbox mr-2">
<span class="text-sm text-gray-700">其他</span>
</label>
</div>
</div>
</div>
</div>
<div class="px-6 py-4 border-t border-gray-200 flex justify-end space-x-3">
<button id="cancelTemplateBtn" class="px-4 py-2 border border-gray-300 rounded-button text-sm text-gray-700 hover:bg-gray-50">取消</button>
<button id="saveTemplateConfirmBtn" class="px-4 py-2 bg-primary text-white rounded-button text-sm hover:bg-blue-600">保存模板</button>
</div>
</div>
</div>
<script id="fileUpload">
document.addEventListener('DOMContentLoaded', function() {
const uploadArea = document.getElementById('uploadArea');
const fileInput = document.getElementById('fileInput');
const selectFileBtn = document.getElementById('selectFileBtn');
const batchUploadBtn = document.getElementById('batchUploadBtn');
const uploadedFiles = document.getElementById('uploadedFiles');
const fileList = document.getElementById('fileList');
const selectedFileCount = document.getElementById('selectedFileCount');
const logArea = document.getElementById('logArea');
let files = [];
function addLog(message, type = 'info') {
const timestamp = new Date().toLocaleTimeString();
const logEntry = document.createElement('div');
logEntry.className = type === 'error' ? 'text-red-400' : type === 'success' ? 'text-green-400' : 'text-gray-300';
logEntry.textContent = `[${timestamp}] ${message}`;
logArea.appendChild(logEntry);
logArea.scrollTop = logArea.scrollHeight;
}
function updateFileCount() {
selectedFileCount.textContent = files.length;
document.getElementById('applyProcessBtn').disabled = files.length === 0;
document.getElementById('exportResultBtn').disabled = files.length === 0;
}
function renderFileList() {
fileList.innerHTML = '';
files.forEach((file, index) => {
const fileItem = document.createElement('div');
fileItem.className = 'flex items-center justify-between p-3 bg-gray-50 rounded-lg';
fileItem.innerHTML = `
<div class="flex items-center">
<div class="w-8 h-8 flex items-center justify-center bg-blue-100 rounded-lg mr-3">
<i class="ri-file-line text-blue-600"></i>
</div>
<div>
<div class="text-sm font-medium text-gray-900">${file.name}</div>
<div class="text-xs text-gray-500">${(file.size / 1024 / 1024).toFixed(2)} MB</div>
</div>
</div>
<button class="text-red-500 hover:text-red-700" onclick="removeFile(${index})">
<i class="ri-delete-bin-line"></i>
</button>
`;
fileList.appendChild(fileItem);
});
uploadedFiles.classList.toggle('hidden', files.length === 0);
}
window.removeFile = function(index) {
files.splice(index, 1);
renderFileList();
updateFileCount();
addLog(`已移除文件: ${files[index]?.name || '未知文件'}`);
};
function handleFiles(selectedFiles) {
Array.from(selectedFiles).forEach(file => {
if (file.size > 100 * 1024 * 1024) {
addLog(`文件 ${file.name} 超过 100MB 限制`, 'error');
return;
}
files.push(file);
addLog(`已添加文件: ${file.name}`, 'success');
});
renderFileList();
updateFileCount();
}
uploadArea.addEventListener('dragover', function(e) {
e.preventDefault();
uploadArea.classList.add('dragover');
});
uploadArea.addEventListener('dragleave', function(e) {
e.preventDefault();
uploadArea.classList.remove('dragover');
});
uploadArea.addEventListener('drop', function(e) {
e.preventDefault();
uploadArea.classList.remove('dragover');
handleFiles(e.dataTransfer.files);
});
selectFileBtn.addEventListener('click', function() {
fileInput.click();
});
fileInput.addEventListener('change', function() {
handleFiles(this.files);
});
batchUploadBtn.addEventListener('click', function() {
fileInput.setAttribute('webkitdirectory', '');
fileInput.click();
});
});
</script>
<script id="toolSelection">
document.addEventListener('DOMContentLoaded', function() {
const toolButtons = document.querySelectorAll('.tool-button');
const configPanel = document.getElementById('configPanel');
const resetToolsBtn = document.getElementById('resetToolsBtn');
let selectedTools = [];
const toolConfigs = {
clean: {
title: '数据清洗配置',
options: [
{ label: '去除重复数据', type: 'checkbox', checked: true },
{ label: '处理缺失值', type: 'select', options: ['删除', '填充均值', '填充中位数', '前向填充'], value: '填充均值' },
{ label: '异常值检测阈值', type: 'range', min: 1, max: 5, value: 3 },
{ label: '去除特殊字符', type: 'checkbox', checked: false }
]
},
format: {
title: '格式转换配置',
options: [
{ label: '目标格式', type: 'select', options: ['JSON', 'CSV', 'XML', 'Parquet'], value: 'JSON' },
{ label: '编码格式', type: 'select', options: ['UTF-8', 'GBK', 'ASCII'], value: 'UTF-8' },
{ label: '压缩输出', type: 'checkbox', checked: false },
{ label: '保留原始格式', type: 'checkbox', checked: true }
]
},
feature: {
title: '特征提取配置',
options: [
{ label: '提取方法', type: 'select', options: ['PCA', 'LDA', 'ICA', '手动选择'], value: 'PCA' },
{ label: '特征维度', type: 'range', min: 10, max: 1000, value: 100 },
{ label: '标准化特征', type: 'checkbox', checked: true },
{ label: '保存特征映射', type: 'checkbox', checked: false }
]
},
normalize: {
title: '数据标准化配置',
options: [
{ label: '标准化方法', type: 'select', options: ['Z-Score', 'Min-Max', 'Robust', 'Unit Vector'], value: 'Z-Score' },
{ label: '处理范围', type: 'select', options: ['全部特征', '数值特征', '自定义'], value: '数值特征' },
{ label: '保留原始数据', type: 'checkbox', checked: false },
{ label: '输出范围 [0,1]', type: 'checkbox', checked: true }
]
}
};
function renderConfigPanel() {
if (selectedTools.length === 0) {
configPanel.innerHTML = `
<div class="p-4 bg-gray-50 rounded-lg">
<p class="text-sm text-gray-600">请先选择预处理工具来配置参数</p>
</div>
`;
return;
}
configPanel.innerHTML = '';
selectedTools.forEach(tool => {
const config = toolConfigs[tool];
const toolDiv = document.createElement('div');
toolDiv.className = 'p-4 border border-gray-200 rounded-lg';
toolDiv.innerHTML = `
<h4 class="text-md font-medium text-gray-900 mb-3">${config.title}</h4>
<div class="space-y-3">
${config.options.map((option, index) => {
if (option.type === 'checkbox') {
return `
<label class="flex items-center">
<input type="checkbox" class="custom-checkbox mr-2" ${option.checked ? 'checked' : ''}>
<span class="text-sm text-gray-700">${option.label}</span>
</label>
`;
} else if (option.type === 'select') {
return `
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">${option.label}</label>
<div class="relative">
<select class="appearance-none w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent pr-8">
${option.options.map(opt => `<option ${opt === option.value ? 'selected' : ''}>${opt}</option>`).join('')}
</select>
<div class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
<i class="ri-arrow-down-s-line text-gray-400"></i>
</div>
</div>
</div>
`;
} else if (option.type === 'range') {
return `
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">${option.label}</label>
<input type="range" class="custom-range" min="${option.min}" max="${option.max}" value="${option.value}">
<div class="flex justify-between text-xs text-gray-500 mt-1">
<span>${option.min}</span>
<span>${option.value}</span>
<span>${option.max}</span>
</div>
</div>
`;
}
}).join('')}
</div>
`;
configPanel.appendChild(toolDiv);
});
}
toolButtons.forEach(button => {
button.addEventListener('click', function() {
const tool = this.dataset.tool;
if (selectedTools.includes(tool)) {
selectedTools = selectedTools.filter(t => t !== tool);
this.classList.remove('active');
} else {
selectedTools.push(tool);
this.classList.add('active');
}
renderConfigPanel();
});
});
resetToolsBtn.addEventListener('click', function() {
selectedTools = [];
toolButtons.forEach(btn => btn.classList.remove('active'));
renderConfigPanel();
});
});
</script>
<script id="templateManagement">
document.addEventListener('DOMContentLoaded', function() {
const saveTemplateBtn = document.getElementById('saveTemplateBtn');
const loadTemplateBtn = document.getElementById('loadTemplateBtn');
const templateModal = document.getElementById('templateModal');
const closeTemplateModal = document.getElementById('closeTemplateModal');
const cancelTemplateBtn = document.getElementById('cancelTemplateBtn');
const saveTemplateConfirmBtn = document.getElementById('saveTemplateConfirmBtn');
function openTemplateModal() {
templateModal.classList.remove('hidden');
document.body.style.overflow = 'hidden';
}
function closeModal() {
templateModal.classList.add('hidden');
document.body.style.overflow = '';
}
saveTemplateBtn.addEventListener('click', openTemplateModal);
closeTemplateModal.addEventListener('click', closeModal);
cancelTemplateBtn.addEventListener('click', closeModal);
templateModal.addEventListener('click', function(e) {
if (e.target === this) {
closeModal();
}
});
saveTemplateConfirmBtn.addEventListener('click', function() {
const templateName = document.getElementById('templateName').value;
if (!templateName) {
alert('请输入模板名称');
return;
}
closeModal();
const notification = document.createElement('div');
notification.className = 'fixed top-4 right-4 bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded-lg z-50';
notification.innerHTML = `模板 "${templateName}" 保存成功`;
document.body.appendChild(notification);
setTimeout(() => {
notification.remove();
}, 3000);
});
});
</script>
<script id="batchSettings">
document.addEventListener('DOMContentLoaded', function() {
const batchSizeSlider = document.getElementById('batchSizeSlider');
const batchSizeValue = document.getElementById('batchSizeValue');
batchSizeSlider.addEventListener('input', function() {
batchSizeValue.textContent = this.value;
});
});
</script>
<script id="processControl">
document.addEventListener('DOMContentLoaded', function() {
const startProcessBtn = document.getElementById('startProcessBtn');
const applyProcessBtn = document.getElementById('applyProcessBtn');
const clearAllBtn = document.getElementById('clearAllBtn');
const exportResultBtn = document.getElementById('exportResultBtn');
const overallProgress = document.getElementById('overallProgress');
const logArea = document.getElementById('logArea');
function addLog(message, type = 'info') {
const timestamp = new Date().toLocaleTimeString();
const logEntry = document.createElement('div');
logEntry.className = type === 'error' ? 'text-red-400' : type === 'success' ? 'text-green-400' : 'text-gray-300';
logEntry.textContent = `[${timestamp}] ${message}`;
logArea.appendChild(logEntry);
logArea.scrollTop = logArea.scrollHeight;
}
function simulateProgress() {
let progress = 0;
const interval = setInterval(() => {
progress += Math.random() * 10;
if (progress >= 100) {
progress = 100;
clearInterval(interval);
addLog('数据预处理完成', 'success');
exportResultBtn.disabled = false;
}
overallProgress.style.width = progress + '%';
}, 500);
}
startProcessBtn.addEventListener('click', function() {
addLog('开始数据预处理...', 'success');
simulateProgress();
});
applyProcessBtn.addEventListener('click', function() {
addLog('应用预处理配置...', 'success');
simulateProgress();
});
clearAllBtn.addEventListener('click', function() {
if (confirm('确定要清空所有文件吗？')) {
window.files = [];
document.getElementById('fileList').innerHTML = '';
document.getElementById('uploadedFiles').classList.add('hidden');
document.getElementById('selectedFileCount').textContent = '0';
addLog('已清空所有文件');
}
});
exportResultBtn.addEventListener('click', function() {
addLog('正在导出处理结果...', 'success');
setTimeout(() => {
addLog('结果导出完成', 'success');
}, 1000);
});
});
</script>
</body>
</html>